SMTP Error
Hi Devs, I am trying to send email using SMTP, my application is hosted on DigitalOcean, whenever I tried sending email, it gives me this error,
"ErrorException: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in file /var/www/html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php on line 94"
Can anyone assist me plz.
Hey Roger,
What is the SMTP port that you are using? Also what is the SMTP encryption set to in your env file?
Usually, I would suggest using port 587
with tls
, here is how the env file would look like in this case:
MAIL_MAILER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_USERNAME=apikey
MAIL_PASSWORD=sendgrid_api_key
MAIL_ENCRYPTION=tls
For more information you can take a look at the following tutorial that I've written some time ago:
How To Create a Laravel Contact Form and Send Emails with SendGrid
Let me know how it goes!
Best,
Bobby
















